package com.bit.blog.common.util;

import com.bit.blog.pojo.dataobject.BlogInfo;
import com.bit.blog.pojo.dataobject.UserInfo;
import com.bit.blog.pojo.request.AddBlogRequest;
import com.bit.blog.pojo.request.UpdateBlogRequest;
import com.bit.blog.pojo.response.BlogInfoResponse;
import com.bit.blog.pojo.response.UserInfoResponse;
import org.springframework.beans.BeanUtils;

public class BeanTransUtils {
    public static BlogInfoResponse trans(BlogInfo blogInfo){
        BlogInfoResponse response = new BlogInfoResponse();
        BeanUtils.copyProperties(blogInfo, response);
        return response;
    }

    public static UserInfoResponse transUser(UserInfo userInfo){
        UserInfoResponse response = new UserInfoResponse();
        BeanUtils.copyProperties(userInfo, response);
        return response;
    }

    public static BlogInfo transBlogInfo(AddBlogRequest blogRequest){
        BlogInfo response = new BlogInfo();
        BeanUtils.copyProperties(blogRequest, response);
        return response;
    }

    public static BlogInfo transBlogInfo(UpdateBlogRequest blogRequest){
        BlogInfo response = new BlogInfo();
        BeanUtils.copyProperties(blogRequest, response);
        return response;
    }


}
